package com.demo.controller;

import com.demo.common.aop.LoginAop;
import com.demo.common.base.ResultModel;
import com.demo.model.Feedback;
import com.demo.service.FeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Description: FeedbackController
 * @Author: ChenXueLi
 * @Date: 2018-10-05 22:57
 */
@Api(value = "FeedbackController", description = "反馈信息接口")
@Controller
@CrossOrigin
@RequestMapping("/feedback")
public class FeedbackController {

    @Autowired
    private FeedbackService feedbackService;

    @ApiOperation(value = "添加反馈信息", notes = "添加反馈信息接口", httpMethod = "POST")
    @RequestMapping(value = "/addFeedback", method = RequestMethod.POST)
    @ResponseBody
    public ResultModel addFeedback(Feedback feedback, ResultModel resultModel, HttpServletRequest request, HttpServletResponse response) throws Exception{
        return feedbackService.addFeedback(feedback, resultModel, request, response);
    }

    @LoginAop
    @ApiOperation(value = "删除反馈信息", notes = "删除反馈信息接口", httpMethod = "POST")
    @RequestMapping(value = "/deleteFeedback", method = RequestMethod.POST)
    @ResponseBody
    public ResultModel deleteFeedback(Feedback feedback, ResultModel resultModel, HttpServletRequest request, HttpServletResponse response) throws Exception{
        return feedbackService.deleteFeedback(feedback, resultModel, request, response);
    }

    @ApiOperation(value = "查询反馈信息列表", notes = "查询反馈信息列表接口", httpMethod = "POST")
    @RequestMapping(value = "/getFeedbackList", method = RequestMethod.POST)
    @ResponseBody
    public ResultModel getFeedbackList(ResultModel resultModel, HttpServletRequest request, HttpServletResponse response) throws Exception{
        return feedbackService.getFeedbackList(resultModel, request, response);
    }

    @LoginAop
    @ApiOperation(value = "快速修改反馈信息处理状态", notes = "快速修改反馈信息处理状态接口", httpMethod = "POST")
    @RequestMapping(value = "/modifyDealState", method = RequestMethod.POST)
    @ResponseBody
    public ResultModel modifyDealState(Feedback feedback, ResultModel resultModel, HttpServletRequest request, HttpServletResponse response) throws Exception{
        return feedbackService.modifyDealState(feedback, resultModel, request, response);
    }

}
